<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<div class="pageContent">
	<form method="post" id="review_main_form" action="${rootUrl}/goods/goods-reviews/${goodsReviews.id}" class="pageForm required-validate" onsubmit="return beforeSubmit(this);">
		<c:if test="${goodsReviews.id != 0 && goodsReviews.id != '' }"><input type="hidden" name="_method" value="put"></c:if>
		<input type="hidden" name="goodsReviews.id" value="${goodsReviews.id }">
		<input type="hidden" name="goodsReviews.goods.id" value="${goodsReviews.goods.id }">
		<input type="hidden" name="goodsReviews.goods.version" value="${goodsReviews.goods.version }">
		<input type="hidden" id="stateId" name="goodsReviews.state" value="${goodsReviews.state }">
		<div class="pageFormContent" layoutH="56">
			<p>
				<label>商品名称：</label>
				<input readonly="readonly" class="required" type="text" size="30" value="${goodsReviews.goods.name}" />
			</p>

			<p>
				<label>商品标题：</label>
				<input readonly="readonly" type="text" size="30" value="${goodsReviews.goods.title}" />
			</p>
			<p>
				<label>类别：</label>
				<input class="required" readonly="readonly" size="30" type="text" value="${goodsReviews.goods.goodsClass.name }" />
			</p>
			<p>
				<label>品牌：</label>
				<input readonly="readonly" size="30" class="required" type="text" value="${goodsReviews.goods.brand.name }" />
			</p>
			<p>
				<label>商家：</label>
				<input type="text" style="float:left" readonly="readonly" size="30" class="required" id="sellerName" value="${goodsReviews.goods.seller.name}"/>
			</p>
			<p>
				<label>仓库：</label>
				<input readonly="readonly" size="30" class="required" type="text" value="${goodsReviews.goods.storage.name }" />
			</p>
			<p>
				<label>总库存：</label>
				<input readonly="readonly" type="text" size="30" value="${goodsReviews.goods.inventory}" />
			</p>
			<p>
				<label>运费：</label>
				<input readonly="readonly" type="text" size="30" value="<c:if test="${goodsReviews.goods.isFreight == 1}">正常</c:if><c:if test="${goodsReviews.goods.isFreight == 0}">免运费</c:if>" />
			</p>
			<p>
				<label>虚拟商品：</label>
				<input readonly="readonly" type="text" size="30" value="<c:if test="${goodsReviews.goods.isVirtual == 0}">否</c:if><c:if test="${goodsReviews.goods.isVirtual == 1}">是</c:if>" />
			</p>
			<p>
				<label>商品状态：</label>
				<input readonly="readonly" type="text" size="30" value="<c:if test="${goodsReviews.goods.state == 0}">下架</c:if><c:if test="${goodsReviews.goods.state%10== 1}">正常</c:if><c:if test="${goodsReviews.goods.state%10== 3}">赠品</c:if><c:if test="${goodsReviews.goods.state-10>0}">待审核</c:if>" />
			</p>
			<p>
				<label>显示价格：</label>
				<input readonly="readonly" type="text" size="30" value="<fmt:formatNumber value='${goodsReviews.goods.price/100}' pattern='0.00'/>" />
			</p>
			<p>
				<label>会员价格：</label>
				<input class="listMoneyField" readonly="readonly" type="text" size="30" value="<fmt:formatNumber value='${goodsReviews.goods.price2/100}' pattern='0.00'/>" />
			</p>
			<p>
				<label>所需积分：</label>
				<input class="listMoneyField" readonly="readonly" type="text" size="30" value="${goodsReviews.goods.points}" />
			</p>
			<dl class="nowrap">
				<dt>商品主图片：</dt>
				<dd>
				<div class="imgContainer"><a href="#" onclick="javascript:void(0)"><img src="${goodsReviews.goods.image}" /></a></div>
				</dd>
			</dl>
			<p>
				<label>点击次数：</label>
				<input  type="text" readonly="readonly" size="30" value="${goodsReviews.goods.click}" />
			</p>
			<p>
				<label>总销量：</label>
				<input type="text" readonly="readonly" size="30" value="${goodsReviews.goods.salenum}" />
			</p>
			<p>
				<label>收藏数：</label>
				<input type="text" readonly="readonly" size="30" value="${goodsReviews.goods.collect}" />
			</p>
			<p>
				<label>评价数：</label>
				<input type="text" readonly="readonly" size="30" value="${goodsReviews.goods.evaluationCount}" />
			</p>
			<p>
				<label>审核状态：</label>
				<input type="text" readonly="readonly" size="30" value="<c:if test="${goodsReviews.goods.verify == 10 || goodsReviews.goods.verify == null}">待审核</c:if>
<c:if test="${goodsReviews.goods.verify == 1}">通过</c:if><c:if test="${goodsReviews.goods.verify == 0}">未通过</c:if>" />
			</p>
			<p>
				<label>添加时间：</label>
				<input type="text" size="30" value="<fmt:formatDate value="${goodsReviews.goods.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/>" readonly="readonly"/>
				<a class="inputDateButton" href="javascript:;">选择</a>
			</p>
			<p>
				<label>上架时间：</label>
				<input type="text" size="30" value="<fmt:formatDate value="${goodsReviews.goods.sellTime}" pattern="yyyy-MM-dd HH:mm:ss"/>" readonly="readonly"/>
				<a class="inputDateButton" href="javascript:;">选择</a>
			</p>
			<p>
				<label>最后编辑时间：</label>
				<input type="text" size="30" value="<fmt:formatDate value="${goodsReviews.goods.editTime}" pattern="yyyy-MM-dd HH:mm:ss"/>" readonly="readonly"/>
				<a class="inputDateButton" href="javascript:;">选择</a>
			</p>
			<dl class="nowrap">
				<dt>审批备注：</dt>
				<dd><textarea name="goodsReviews.remark" cols="150" rows="5">${goodsReviews.remark}</textarea></dd>
			</dl>
			<p>
				<label>审核人：</label>
				<input type="text" readonly="readonly" id="specName" name="userName" class="required" size="30" value="${userName }" />
			</p>
			<div>
			<table class="table" targetType="dialog"  width="100%">
			<thead>
				<tr>
					<th width="160">类别</th>
					<th width="160">前台查看</th>
					<th width="160">子标题</th>
					<th width="40">价格类别</th>
					<th width="40">价格</th>
					<th width="40">库存</th>
					<th width="40">点击量</th>
					<th width="40">销售量</th>
					<th width="40">收藏数</th>
					<th width="40">重量</th>
					<th width="40">状态</th>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${goodsPrices}" var="goodsPrice" varStatus="status2">
					<tr target="data_id" rel="${goodsPrice.id}">
						<c:if test="${status2.index%goodsSkuSize == 0 }">
							<td rowspan="${goodsSkuSize}">${goodsPrice.goodsSku.specName }</td>
							<td rowspan="${goodsSkuSize}"><a title="浏览" target="_blank" title="浏览"  href="${systemConfig.webUrl}${goodsPrice.goodsSku.id}.htm" class="btnView">浏览</a></td>
							<td rowspan="${goodsSkuSize}">${goodsPrice.goodsSku.subTitle }</td>
						</c:if>
							<td>${goodsPrice.priceClassName }</td>
							<td><fmt:formatNumber value="${goodsPrice.price/100}" pattern="0.00"/></td>
						<c:if test="${status2.index%goodsSkuSize == 0 }">
							<td rowspan="${goodsSkuSize}">${goodsPrice.goodsSku.inventory }</td>
							<td rowspan="${goodsSkuSize}">${goodsPrice.goodsSku.click }</td>
							<td rowspan="${goodsSkuSize}">${goodsPrice.goodsSku.salenum }</td>
							<td rowspan="${goodsSkuSize}">${goodsPrice.goodsSku.collect }</td>
							<td rowspan="${goodsSkuSize}">${goodsPrice.goodsSku.weight }</td>
							<td rowspan="${goodsSkuSize}"><c:if test="${goodsPrice.goodsSku.state == 0}">下架</c:if><c:if test="${goodsPrice.goodsSku.state%10== 1}">正常</c:if><c:if test="${goodsPrice.goodsSku.state%10== 3}">赠品</c:if><c:if test="${goodsPrice.goodsSku.state-10>0}">待审核</c:if></td>
						</c:if>
					</tr>
				</c:forEach>
			</tbody>
		</table>
		</div>
   		 </div>
    	<div class="formBar">
			<ul>
				<li id="export"><div class="<c:if test="${goodsReviews.state != 0}">buttonDisabled</c:if><c:if test="${goodsReviews.state == 0}">buttonActive</c:if>"><div class="buttonContent"><button <c:if test="${goodsReviews.state != 0}">disabled="disabled"</c:if> onclick="pass()" type="button">通过</button></div></div></li>
				<li id="delivered"><div class="<c:if test="${goodsReviews.state != 0}">buttonDisabled</c:if><c:if test="${goodsReviews.state == 0}">buttonActive</c:if>"><div class="buttonContent"><button <c:if test="${goodsReviews.state != 0}">disabled="disabled"</c:if> onclick="reject()" type="button">不通过</button></div></div></li>
				
				<li>
					<div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div>
				</li>
			</ul>
		</div>
    </form>
    	
</div>
<script>
	function pass(){
		alertMsg.confirm("确定要通过该商品审核吗？", {
			okCall: function(){
				$("#stateId").val("1");
				$("#review_main_form").submit();
			}
		});
	}
	function reject(){
		alertMsg.confirm("确定要不通过该商品审核吗？", {
			okCall: function(){
				$("#stateId").val("-1");
				$("#review_main_form").submit();
			}
		});
	}
	function beforeSubmit(obj){
		return validateCallback(obj, newDialogAjaxDone);
	}
</script>